﻿using Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class AreaService : IDisposable
    {
        public ApplicationDbService<ApplicationDbContext> DBService { get; set; }
        public AreaService()
        {
            DBService = new ApplicationDbService<ApplicationDbContext>(new ApplicationDbContext());
        }

        public IList<AreaEntity> GetAreaList(string parentId)
        {
            return DBService.GetMany<AreaEntity>(m => m.ParentId == parentId);
        }

        public virtual void Dispose()
        {
            this.Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (disposing && this.DBService != null)
            {
                this.DBService.Dispose();
            }
        }
    }
}
